<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
   <%@page import="diplom.shop.web.*"%>
<%@page import="diplom.shop.domain.*"%>
<%@page import="diplom.shop.services.*"%>
<%@page import="java.util.*"%>


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script src="../js/jquery.js" type="text/javascript" ></script>
<script src="../js/myjs.js" type="text/javascript" ></script>

<title>Insert title here</title>
</head>
<body>

<form id="addNewDevicForm" name="addNewDevicForm" action="addServlet" method="post">
					<table>
						<tr>
						<td><label>Категорія товару</label></td>
						<td><select id="category" name="category">
						<option selected disabled value ="0">Выберите героя</option>
							<option value="26">Lola</option>
							<option value="28">Bola</option>
						</select> </td> 
						</tr>
						<tr>
						<td><label>Назва товару</label></td>
						<td><input type="text" id="deviceName"	name="deviceName" /></td> 
						</tr>
						<tr>
						<td><label>Вартість</label></td>
						<td><input type="text"	id="cost" name="cost" /></td> 
						</tr>
						<tr>
						<td><label>Гарантія</label></td>
						<td><input type="text" id="guaranty" name="guaranty" /></td> 
						</tr>
						<tr>
						<td><label>Фото</label></td>
						<td><input type="text" id="image" name="image" /></td> 
						</tr>
					 	
						<%
					 		if(DeviceWeb.isCategoryIdSet(request)){
					 				Category category = DeviceWeb.getCategoryById(request);
					 			  // 	session.setAttribute("category",category.getCategoryId());
					 			//	out.print(request.getAttribute("category")+ " request" );
					 			//	out.print(session.getAttribute("category")+ " session");
					 			List<ArrayList<String>> mouseForm = DomainServices.getForm(category.getCategoryId());
					 			for(ArrayList<String> s : mouseForm) {
					 	%>
					 	<td><label><%out.print(s.get(0));%></label></td>
					 	<td><input id="<%out.print(s.get(1));%>" name="<%out.print(s.get(1));%>"	type="text" /></td>
						</tr>
						<%
							}}
						%>
						</table>
						
						<input type="submit" value="Send" />
					</form>
</body>
</html>